package tag1;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.tagext.BodyTagSupport;

public class SimpleTag2 extends BodyTagSupport{
	private static final long serialVersionUID = 3964343505044946586L;
	
	@Override
	public int doEndTag() throws JspException {
		BodyContent body=getBodyContent();
		StringBuilder content = new StringBuilder(body.getString());
		body.clearBody();//清理body中内容
		
		//输出body内容
		JspWriter out = pageContext.getOut();
		try {
			out.println(content);
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		return super.doAfterBody();
	}
	
}
